import { PlatformInterface } from '#/PlatformInterface';
export const getPlatformInfo = () => {
  const platformData:PlatformInterface = {
    platform: '',
    env: import.meta.env.MODE,
    baseUrl: ''
  };
  //微信
  // #ifdef MP-WEIXIN
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_WEIXIN;
  platformData.platform = 'WEIXIN';
  // #endif

  //H5
  // #ifdef H5
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_H5;
  platformData.platform = 'H5';
  // #endif

  //WEB
  // #ifdef WEB
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_WEB;
  platformData.platform = 'WEB';
  // #endif

  //鸿蒙元服务
  // #ifdef MP-HARMONY
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_HARMONY;
  platformData.platform = 'HARMONY';
  // #endif

  //支付宝小程序
  // #ifdef MP-ALIPAY
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_ALIPAY;
  platformData.platform = 'ALIPAY';
  // #endif

  //抖音小程序
  // #ifdef MP-TOUTIAO
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_TOUTIAO;
  platformData.platform = 'TOUTIAO';
  // #endif

  //飞书小程序
  // #ifdef MP-LARK
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_LARK;
  platformData.platform = 'LARK';
  // #endif

  //快手小程序
  // #ifdef MP-KUAISHOU
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_KUAISHOU;
  platformData.platform = 'KUAISHOU';
  // #endif

  //京东小程序
  // #ifdef MP-JD
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_JD;
  platformData.platform = 'JD';
  // #endif

  //小红书小程序
  // #ifdef MP-XHS
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_XHS;
  platformData.platform = 'XHS';
  // #endif

  //鸿蒙APP
  // #ifdef APP-HARMONY
  platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_HARMONYAPP;
  platformData.platform = 'HARMONYAPP';
  // #endif

  let port = uni.getSystemInfoSync().platform
  //安卓
  if (port === 'ANDROIDAPP' || port === 'android') {
    platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_ANDROID;
    platformData.platform = 'ANDROIDAPP';
  } 
  //IOS
  if (port === 'IOS' || port === 'ios') {
    platformData.baseUrl = import.meta.env.VITE_BASE_BASE_API_IOS;
    platformData.platform = 'IOSAPP';
  }
  return platformData;
};
